package com.eastfair.venuebooking.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.eastfair.boot.request.PageParams;
import com.eastfair.boot.service.SuperService;
import com.eastfair.venuebooking.dto.*;
import com.eastfair.venuebooking.entity.Contact;
import com.eastfair.venuebooking.vo.ContactVO;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * <p>
 * 业务接口
 * 客户及线索联系人表
 * </p>
 *
 * @author linan
 * @date 2022-06-08
 */
public interface ContactService extends SuperService<Contact> {

    /**
     * 分页查询联系人列表.
     *
     * @param pageParams the page params
     * @return the page
     */
    IPage<ContactVO> listContactVOs(PageParams<ContactQuery> pageParams) throws Exception;

    /**
     * ID列表查询联系人列表.
     *
     * @param ids the ids
     * @return the list
     */
    List<Contact> listByIds(List<Long> ids);

    /**
     * 查询待同步到cms的联系人.
     *
     * @return the list
     */
    List<ContactVO> listWaitCmsSync();

    /**
     * 查询首要联系人.
     *
     * @param customerId  the customer id
     * @param subjectType the subject type
     * @return the contact
     */
    Contact getImportantContact(Long customerId, String subjectType);

    /**
     * id查询联系人.
     *
     * @param id the id
     * @return the contact
     */
    ContactVO getContactVOById(Long id);

    /**
     * 保存联系人.
     *
     * @param saveDTO the save dto
     * @return the boolean
     */
    boolean saveContact(ContactDTO saveDTO);

    /**
     * 修改联系人.
     *
     * @param updateDTO the update dto
     * @return the boolean
     */
    boolean updateContact(ContactDTO updateDTO);

    /**
     * 更新联系人cms同步状态为已同步.
     *
     * @param ids the ids
     * @return the boolean
     */
    boolean updateCrmHasSync(List<Long> ids);

    /**
     * 移除联系人.
     *
     * @param ids the ids
     * @return the boolean
     */
    boolean removeContactByIds(List<Long> ids);

    /**
     * 导出联系人.
     *
     * @param contactDTO the contact dto
     * @param response   the response
     */
    void exportContact(ContactQuery contactDTO, HttpServletResponse response) throws Exception;
}
